{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from IPython.display import display\n",
    "from sympy import *\n",
    "import numpy as np\n",
    "init_printing()\n",
    "\n",
    "def gradient(scalar_function, variables):\n",
    "    matrix_scalar_function = Matrix([scalar_function])\n",
    "    return matrix_scalar_function.jacobian(variables)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "m, n, a, b, c, d, t=symbols('m, n,a, b, c, d, t')\n",
    "f = (a*t+b)**m*(c*t+d)**n\n",
    "integrate(f, (t, 0, 1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAANgAAABKBAMAAAAroIeWAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAMs2Zq91U7yJ2iRBE\nu2Z2muS3AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAEQklEQVRYCe2XTYgURxTH/z3jfHXPx96ih7Dj\naCAhgaxmvawkzilkCMY5BEmC4AgJ5LYbRfCiDuhJSXZkFVEidiIeNJAMmiA5hJ1DgsddkoA5ZQeD\nBwWTUWT92NXkVb2unv4SZ2G7ILjFTNWrV796/65X3dUzgCxGmVsdtTFa1yHjaKRXxJYj2ytpXI4s\nQm8aJ5blmgcKkt10rzUQuAI9rxlIXmzrW/rxK1VtYtZiSt+9n+tpWxeQmtUoNqkvicDZjsaVzbU1\nit3XqGXc0yiWe6hRrLA4oFjxrTVTuTNDA9GCjQJLC1HeCF9xppt5N1eNGAm7BNsMuzFcj3BGuY6e\nQKmTtKOGQj7BRt3k/1Qd9IvQlL6j2CS7hheQakjnAOxVCQaqbS12ZGcDA6r7016y3qHvZziDSUO4\nn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S7Q9AAAAABJRU5ErkJg\ngg==\n",
      "text/latex": [
       "$$\\int_{0}^{1} \\left(a t + b\\right)^{m} \\left(c t + d\\right)^{n}\\, dt$$"
      ],
      "text/plain": [
       "1                         \n",
       "⌠                         \n",
       "⎮          m          n   \n",
       "⎮ (a⋅t + b) ⋅(c⋅t + d)  dt\n",
       "⌡                         \n",
       "0                         "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "class TriBasis():\n",
    "    def __init__(self, p):\n",
    "        self.p = p\n",
    "        self.idx_matrix()\n",
    "        \n",
    "    def idx_matrix(self):\n",
    "        p = self.p\n",
    "        ldof = self.number_of_basis_function()\n",
    "        idx = Matrix(range(ldof))\n",
    "        f = lambda x: floor((-1 + sqrt(1 + 8*x))/2)\n",
    "        g = lambda x: x*(x +1)/2\n",
    "        idx0 = idx.applyfunc(f)\n",
    "        idxMatrix = zeros(ldof, 3)\n",
    "        idxMatrix[:,2] = idx - idx0.applyfunc(g)\n",
    "        idxMatrix[:,1] = idx0 - idxMatrix[:,2]\n",
    "        idxMatrix[:,0] = ones(ldof, 1)*p - idxMatrix[:, 1] - idxMatrix[:, 2] \n",
    "        self.idxMatrix = idxMatrix\n",
    "        \n",
    "    def basis(self, lam0, lam1, lam2):\n",
    "        p = self.p\n",
    "        ldof = self.number_of_basis_function()\n",
    "        phi = zeros(ldof, 1)\n",
    "        t = Matrix(range(p))/p\n",
    "        f = lambda x: 1/factorial(x)\n",
    "        bc = Matrix([lam0, lam1, lam2])\n",
    "        P = ones(p+1, 1)\n",
    "        c = Matrix(range(0, p+1))\n",
    "        P = c.applyfunc(f)\n",
    "        AA = ones(p+1, 3)\n",
    "        AA[1:, :] = ones(p, 1)*bc.transpose() - t*ones(1, 3)\n",
    "        # B = DiagonalMatrix(P)*Matrix(np.multiply.accumulate(AA, axis=0))\n",
    "        B = Matrix(np.multiply.accumulate(AA, axis=0))\n",
    "        idxMatrix = self.idxMatrix\n",
    "        for i in range(ldof):\n",
    "            phi[i] = B[idxMatrix[i, 0], 0]*B[idxMatrix[i, 1], 1]*B[idxMatrix[i, 2], 2]\n",
    "        return phi\n",
    "        \n",
    "    def number_of_basis_function(self):\n",
    "        p = self.p\n",
    "        return int((p+1)*(p+2)/2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "x, y, x0, y0, x1, y1, x2, y2, theta = symbols('x y x_0 y_0 x_1 y_1 x_2 y_2 theta')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "p = Matrix([[x, y]])\n",
    "p0 = Matrix([[x0, y0]])\n",
    "p1 = Matrix([[x1, y1]])\n",
    "p2 = Matrix([[x2, y2]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "W = Matrix([[0,1], [-1, 0]])\n",
    "A = Matrix([\n",
    "        [x0, x1, x2],\n",
    "        [y0, y1, y2],\n",
    "        [1, 1, 1]\n",
    "    ])\n",
    "D0 = Matrix([\n",
    "        [x, x1, x2],\n",
    "        [y, y1, y2],\n",
    "        [1, 1, 1]\n",
    "    ])\n",
    "D1 = Matrix([\n",
    "        [x0, x, x2],\n",
    "        [y0, y, y2],\n",
    "        [1, 1, 1]\n",
    "    ])\n",
    "D2 = Matrix([\n",
    "        [x0, x1, x],\n",
    "        [y0, y1, y],\n",
    "        [1, 1, 1]\n",
    "    ])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "lam0 = det(D0)/det(A)\n",
    "lam1 = det(D1)/det(A)\n",
    "lam2 = det(D2)/det(A)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAZBAMAAADDORPgAAAALVBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAOrOgAAAADnRSTlMAu90iVO8Qq5l2zWZEiR5B\np0cAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAA4SURBVBgZYxBSMmAAAh4lXQYFEAMEzPEwWcJgCtLb\nn8GYDJz0ZHKUvqrG70iQJ/D6AlOBEiwc1AEZDRbAUy+zwAAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$$\\left[\\begin{matrix}1\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "[1]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAZBAMAAADDORPgAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAu90iEJmJZjLNVO+r\nRHY8nXFNAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAeElEQVQYGWMQUjJgAAJeJTUGBRADBGzQmCxh\nZQ1QUc4FLMpQZjUDQyaUKcPAsN4Bou0PA8P9BWAmy1cg8wGYyfyNgaE/AcIEikKZSAoYgNrWQ7Qx\nCDIw1DtADANaEckAYTItYNkBZbLkvYE5B+RaqCiFTCVYOOgAALX2IMEQ20hWAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$$\\left[\\begin{matrix}0\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "[0]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAZBAMAAADDORPgAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAu90iEJmJZjLNVO+r\nRHY8nXFNAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAeElEQVQYGWMQUjJgAAJeJTUGBRADBGzQmCxh\nZQ1QUc4FLMpQZjUDQyaUKcPAsN4Bou0PA8P9BWAmy1cg8wGYyfyNgaE/AcIEikKZSAoYgNrWQ7Qx\nCDIw1DtADANaEckAYTItYNkBZbLkvYE5B+RaqCiFTCVYOOgAALX2IMEQ20hWAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$$\\left[\\begin{matrix}0\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "[0]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "phi0 = simplify(lam1*gradient(lam2, p)*W.transpose() - lam2*gradient(lam1, p)*W.transpose())\n",
    "phi1 = simplify(lam2*gradient(lam0, p)*W.transpose() - lam0*gradient(lam2, p)*W.transpose())\n",
    "phi2 = simplify(lam0*gradient(lam1, p)*W.transpose() - lam1*gradient(lam0, p)*W.transpose())\n",
    "\n",
    "## 验证 \n",
    "f = simplify((p2 - p1)*W.transpose()*phi0.transpose())\n",
    "f = simplify(f.subs({x:x1 + theta*(x2 - x1), y:y1+theta*(y2 - y1)}))\n",
    "display(f)\n",
    "\n",
    "g = simplify((p0 - p2)*W.transpose()*phi0.transpose())\n",
    "g = simplify(g.subs({x:x2 + theta*(x0 - x2), y:y2+theta*(y0 - y2)}))\n",
    "display(g)\n",
    "\n",
    "m = simplify((p1 - p0)*W.transpose()*phi0.transpose())\n",
    "m = simplify(m.subs({x:x0 + theta*(x1 - x0), y:y0+theta*(y1 - y0)}))\n",
    "display(m)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAAsAAAAqBAMAAACXcryGAAAALVBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAOrOgAAAADnRSTlMAVO8Qq5l2zWYiibvdRH6G\nTkUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAB0SURBVBgZY2CAASEDIIvZ1Q9EMTDkUYMK0StpAJtG\nFvEOBB4QpXXWqo1AdZwBDHINDAxsDxn4DjAw8Ooy2BWAdYMEgV47BSI51wSDKAaGRRfAFJMyUGwC\nA/dDBga+x2CKaQMDz0sGBo4GBrkEoJKroXsZGAAuYx+6av2YygAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$$\\frac{1}{3}$$"
      ],
      "text/plain": [
       "1/3"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "psi0 = simplify(lam1*gradient(lam2, p)*W.transpose() + lam2*gradient(lam1, p)*W.transpose())\n",
    "psi1 = simplify(lam2*gradient(lam0, p)*W.transpose() + lam0*gradient(lam2, p)*W.transpose())\n",
    "psi2 = simplify(lam0*gradient(lam1, p)*W.transpose() + lam1*gradient(lam0, p)*W.transpose())\n",
    "psi = simplify((p2 - p1)*W.transpose()*psi0.transpose())[0]*(lam1 - lam2)\n",
    "psi = simplify(psi.subs({x:x1 + theta*(x2 - x1), y:y1+theta*(y2 - y1)}))\n",
    "d = Integral(psi, (theta, 0, 1))\n",
    "display(d.nsimplify())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAAsAAAAqBAMAAACXcryGAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAVO8Qq5l2zWYiuzKJ\nRN0MreaOAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAcElEQVQYGWNggAEhAyCL2dUfRDEw5FODCtEv\naQCbRhbxHwQ+EKV1atRqoDpmB4bzFxgYWAwYmBQYGJgeMLD8ZmBg/wymgNJ8n8Fm3T8App6ASdYA\nMJUKJhkDGGYCGVsZGDIZGDjfnAl5ANQOdMMDBgC/syNtm3aMLwAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$$\\frac{1}{2}$$"
      ],
      "text/plain": [
       "1/2"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAAsAAAAqBAMAAACXcryGAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAVO8Qq5l2zWYiuzKJ\nRN0MreaOAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAcElEQVQYGWNggAEhAyCL2dUfRDEw5FODCtEv\naQCbRhbxHwQ+EKV1atRqoDpmB4bzFxgYWAwYmBQYGJgeMLD8ZmBg/wymgNJ8n8Fm3T8App6ASdYA\nMJUKJhkDGGYCGVsZGDIZGDjfnAl5ANQOdMMDBgC/syNtm3aMLwAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$$\\frac{1}{2}$$"
      ],
      "text/plain": [
       "1/2"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "k = 1\n",
    "triBasis = TriBasis(k)\n",
    "b = triBasis.basis(lam0, lam1, lam2)\n",
    "b = b[-1:-(k+2):-1]\n",
    "for i in range(k+1):\n",
    "    bi = simplify(b[i].subs({x:x1 + theta*(x2 - x1), y:y1+theta*(y2 - y1)}))\n",
    "    d = Integral(bi, (theta, 0, 1))\n",
    "    display(d.nsimplify())\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXgAAAAUBAMAAAB18jsAAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA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jPIBE\na6q2aQ90g3eX7n6fE+ryDaycbtOYH+AVg6OL25arkrUyvKc0xyngNZ76EW0D+ed557Nl2vk+KDLC\nA4mGM+rANgd3lHY+ZhaaKSBpciki3jGKp/cSvTXlJRXPKyPzN9m/AgexOZe5p4pvUnsjQz1f7gOE\njPBAotGBrXHik1R8O8+jVfkpwCaTW1+vXTW59G7YUx69eXTZh6UGc6wVOFS89UV9sohDwaKvis9W\nvdPAH1gqaSBklIejARO09yRvlugK/pJHq5KZq1VMbrTbfWhyuDwxDnwerC7kwe0j1wG6WUQLWFTm\nEH3gFOGO0fz4fId6rTbZoFtvjOb2QZERHo4G7JLPAx4BXykVwrVyjtlNoSgvxrDonqKOUVJdGWh6\nrRx9bbx0oQ+z1dPm0diUtXK4Za58CfYi5VjXy2M/I99aOfjPWPyiKb7jLJ/gFRQ7h/8BD8ruf4VB\nWRAAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$$\\left ( 7, \\quad 8, \\quad 2, \\quad 8, \\quad 0.007291666666666667\\right )$$"
      ],
      "text/plain": [
       "(7, 8, 2, 8, 0.007291666666666667)"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "1, 1 /2\n",
    "1, 2, 1/12\n",
    "2, 2, 2, 2/72\n",
    "7, 8, 2, 8, 7/960"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAABMAAAAPBAMAAAD0aukfAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAVO8Qq5l2zWYiuzKJ\nRN0MreaOAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAbUlEQVQIHWNgAAHO0FUbgBSjMgODCQPPXyAZ\n8pmBwZmBQQkoygZk6jEw+ANVgJj1BnAmUPK9AUSUgYH3D1QtAwOfA5wZCmSBtTGwBcCZogycEyCi\n3AEMbFDmvDNH/RgYWJ2+ezDU////D6QYBgAQhh3Nze/QcQAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$$12$$"
      ],
      "text/plain": [
       "12"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "factorial(3)*2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Nedelec's edge element "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2d "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 3d "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  },
  "latex_envs": {
   "bibliofile": "biblio.bib",
   "cite_by": "apalike",
   "current_citInitial": 1,
   "eqLabelWithNumbers": true,
   "eqNumInitial": 0
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
